package com.generator;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author xx
 * date: 2020/11/9 11:24
 */
@SpringBootApplication
@MapperScan(basePackages = {"com.generator.mapper"})
@Slf4j
public class GeneratorApplication extends WebMvcConfigurationSupport {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(GeneratorApplication.class, args);
        ConfigurableEnvironment en = applicationContext.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t" +
                        "\t\t启动成功\n\t"+
                        "代码生成 类型1前端 2后台：http://{}:{}/genscheme/generator/{type}/{id}\n"+
                        "----------------------------------------------------------",
                InetAddress.getLocalHost().getHostAddress(), en.getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(), en.getProperty("server.port"));
    }

}
